From: Florian Müllner Date: Fri, 5 Dec 2025 09:06:32 +0000 (+0100) Subject: workspaceAnimation: Use separate WorkspaceBackground class X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~44^2~48 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b5e82f6e897fd081518020580ad73bb629bacf3f;p=gnome-shell.git workspaceAnimation: Use separate WorkspaceBackground class Separating WorkspaceGroup and WorkspaceBackground allows each to track its own set of windows without special-casing exceptions. This will also give us more flexibility in the future, if we need to reuse the background elsewhere. This may happen if we optionally change the animation to a crossfade for the new `reduced-motion` setting. Part-of: --- diff --git a/js/ui/workspaceAnimation.js b/js/ui/workspaceAnimation.js index 0045a677b..8d7b2594e 100644 --- a/js/ui/workspaceAnimation.js +++ b/js/ui/workspaceAnimation.js @@ -143,29 +143,33 @@ class WorkspaceGroup extends BaseWorkspaceGroup { if (!this._workspace) return; - this._background = new Meta.BackgroundGroup(); + this._background = new WorkspaceBackground(this._workspace, this._monitor); this.add_child(this._background); + } +}); + +export const WorkspaceBackground = GObject.registerClass( +class WorkspaceBackground extends BaseWorkspaceGroup { + _shouldShowWindow(window) { + return this._isDesktopWindow(window) && + this._windowIsOnThisMonitor(window); + } + + _createBackground() { + const background = new Meta.BackgroundGroup(); + this.add_child(background); this._bgManager = new Background.BackgroundManager({ - container: this._background, + container: background, monitorIndex: this._monitor.index, controlPosition: false, }); - this._createDesktopWindows(); - } - - _createDesktopWindows() { - const desktopActors = global.get_window_actors().filter(w => { - return this._isDesktopWindow(w.meta_window) && this._windowIsOnThisMonitor(w.meta_window); - }); - desktopActors.map(a => this._createClone(a)).forEach(clone => this._background.add_child(clone)); } _onDestroy() { super._onDestroy(); - if (this._workspace) - this._bgManager.destroy(); + this._bgManager.destroy(); } });